<?php
/**
 * @version 1.0
 * @author Tronghm
 */
class Rabbit_Utility_String {
    /**
     * Get complete paragraph text form input text
     * @param string $input
     * @param int $numberCharacter
     * @return string
     */
    public static function truncateString($input, $numberCharacter) {
        if (strlen($input) > $numberCharacter) {
            for ($k = $numberCharacter; $k > 0; $k--) {
                if (( $input[$k] == ' ' || $input[$k] == ',' || $input[$k] == '.'))
                    break;
            }
            $result = substr($input, 0, $k);
            $result.="... ";
        }
        else {
            $result = $input;
        }
        return $result;
    }
}

?>
